@extends('layouts.app')
@section('title','读信')

@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                @foreach($letters as $letter)
                    <div class="panel  panel-group " style="border-left: solid 1px rgba(0, 0, 0, 0.08);border-bottom: 1px solid rgba(0, 0, 0, 0.08);box-shadow: 0 1px 1px rgba(0, 0, 0, 0.17)" >
                        <div class="panel-heading panel-primary" >
                            <div class="panel-title panel" onclick="window.location.href='letters/{{$letter->letter_id}}'" style="border-bottom: 1px solid rgba(0, 0, 0, 0.08);box-shadow: 0 1px 1px rgba(0, 0, 0, 0.17);" >
                                <h3>{{$letter->title}}</h3>
                            </div>
                            <div class="panel panel-footer" style="">
                                <span  >寄信人 {{$letter->user}} </span>
                                <span class="pull-right">于{{$letter->created_time}}投递</span>
                            </div>


                            <div class="panel panel-footer " style="margin-bottom: 15px;border:hidden;background-color:@if($letter->status==2)
                                    rgba(188, 232, 241, 0.32)
                            @elseif($letter->status==3)
                                    rgba(101, 169, 66, 0.12)
                            @elseif($letter->status==4)
                                    rgba(169, 66, 66, 0.12);
                            @else
                                    rgba(188, 232, 241, 0.32)
                            @endif">
                                @if($letter->status==2)
                                    <span class="pull-right">将在{{$letter->send_time}}送出</span>
                                @elseif($letter->status==3)
                                    <span class="pull-right">已在{{$letter->send_time}}送出</span>
                                @elseif($letter->status==4)
                                    <span >{{$letter->send_time}}寄送失败，请联系
                                <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=847510938&site=qq&menu=yes">
                                    送信小哥
                                </a>
                             </span>
                                @else
                                    <span>将在{{$letter->send_time}}送出</span>
                                @endif

                                <span  class="@if($letter->status==4) hidden @endif;"> 收件人 {{$letter->to}}</span>
                            </div>
                            <div class=" panel panel-collapse" style="line-height: 32px">
                                <span class='text-capitalize'>浏览{{$letter->views}}次</span>
                                <span class="pull-right text-primary">
                                    <span class="btn btn-sm btn-success">喜欢(90)</span>
                                    <div class="btn btn-sm btn-primary" onclick="commnet({{$letter->letter_id}})">
                                        评论(20)
                                    </div>
                                </span>

                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
        </div>
    </div>
    
    <div  id="comment" class="">

    </div>
@endsection

@section('js')
    <script src="{{ asset('js/jq.js') }}"></script>
    <script src="{{ asset('layer/layer.js') }}"></script>
    <script>
        function commnet(id) {

            layer.open({
                title: ['评论', 'font-size:14px;text-align:center;'],
                anim: '4',
                resize: true,
                moveOut: true,
                type: 1,
                conten:$("#comment")
            });
        }

    </script>

@endsection
